http://paulbutler.org/archives/visualizing-facebook-friends/
http://science.sciencemag.org/content/suppl/2016/09/28/353.6307.1532.DC1
plot(gmap(occdata, type = "satellite")) points(occdata, col = "red", pch=20, cex = 2)
| species | lon | lat | |
|---|---|---|---|
| 1 | Solanum acaule Bitter | -66.10 | -21.90 |
| 2 | Solanum acaule Bitter | -71.00 | -13.50 |
| 52 | Solanum acaule Bitter | -66.43 | -24.22 |
| 53 | Solanum acaule Bitter | -72.07 | -13.35 |
| 54 | Solanum acaule Bitter | -68.97 | -15.23 |
| 55 | Solanum acaule Bitter | -64.95 | -17.75 |
coordinates(occs) <- c("lon", "lat")
str(occs, 2)
Formal class 'SpatialPointsDataFrame' [package "sp"] with 5 slots ..@ data :'data.frame': 49 obs. of 1 variable: ..@ coords.nrs : int [1:2] 2 3 ..@ coords : num [1:49, 1:2] -66.1 -71 -66.4 -72.1 -69 ... .. ..- attr(*, "dimnames")=List of 2 ..@ bbox : num [1:2, 1:2] -72.5 -24.2 -64.7 -12.5 .. ..- attr(*, "dimnames")=List of 2 ..@ proj4string:Formal class 'CRS' [package "sp"] with 1 slot
crs(occs) <- CRS("+proj=longlat +ellps=WGS84 +datum=WGS84")
plot(gmap(occs, type = "satellite")) points(Mercator(occs), col = "red", pch = 20, cex = 2)
occs <- shapefile("data/occs.shp")
plot(gmap(occs, type = "satellite"))
points(Mercator(occs), col = "red", pch = 20, cex = 2)
library(ggmap)
map <- get_map(bbox(occs), maptype = "watercolor", source = "stamen")
ggmap(map) +
geom_point(aes(x = coords.x1, y = coords.x2),
data = as.data.frame(coordinates(occs)),
colour = "red", size = 4)
elevation <- getData("alt", country = "ESP")
plot(elevation)
library(rasterVis) levelplot(elevation)
library(mapview) mapView(occs)
http://bleutner.github.io/RStoolbox/
And many more packages! (MODIS, Landsat, LiDAR…)
Fully-reproducible scripts
Harness all R stats power
Data wrangling
Modelling
Dataviz
Easy!
Slides and source code available at https://github.com/Pakillo/GISwithR